package org.example.domain.user.service.impl;

import org.example.Interfaces.dto.UserQueryDto;
import org.example.domain.user.entity.User;
import org.example.domain.user.repository.UserRepository;
import org.example.domain.user.service.UserService;
import org.example.model.PageInfo;
import org.example.service.AbstractBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl extends AbstractBaseService<User> implements UserService {

    public UserServiceImpl(@Autowired UserRepository repository) {
        super(repository);
    }

    @Override
    public List<User> listByName(String name) {
        return ((UserRepository)repository).listByName(name);
    }

    @Override
    public List<User> queryUsers(UserQueryDto userQueryDto) {
        return ((UserRepository)repository).queryUsers(userQueryDto);
    }

    @Override
    public PageInfo<User> queryUserPage(UserQueryDto userQueryDto) {
        return ((UserRepository)repository).listByPage(userQueryDto);
    }
}
